

using System;
using System.Collections.Generic;
using System.Text;
using EntityLayer;
using System.Data;
using DataAccessLayer;
using InfraStructureLayer;

namespace DataLayer
{
	public class datArticleCategories
	{
		public datArticleCategories()
		{
		}
		
		#region  Code Factory Generated Methods
		public void DeleteArticleCategoriesByArticleCategoryId(entArticleCategories parEntArticleCategories, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pArticleCategoryId",parEntArticleCategories.ArticleCategoryId);
			parDbConnector.ExecuteNonQuery("DeleteArticleCategoriesByArticleCategoryId",insDbParamCollection);
		}
		public void InsertArticleCategories(entArticleCategories parEntArticleCategories, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pArticleCategoryDescription",parEntArticleCategories.ArticleCategoryDescription);
			insDbParamCollection.AddOutput("@pArticleCategoryId",DbType.Int32);
			parDbConnector.ExecuteNonQuery("InsertArticleCategories",insDbParamCollection);
			parEntArticleCategories.ArticleCategoryId = Convert.ToInt32(insDbParamCollection.GetOutPutParameter().Value);
		}
		public void UpdateArticleCategoriesByArticleCategoryId(entArticleCategories parEntArticleCategories, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pArticleCategoryId",parEntArticleCategories.ArticleCategoryId);
			
			insDbParamCollection.Add("@pArticleCategoryDescription",parEntArticleCategories.ArticleCategoryDescription);
			parDbConnector.ExecuteNonQuery("UpdateArticleCategoriesByArticleCategoryId",insDbParamCollection);
		}
		public DataTable SelectArticleCategories(DbConnector parDbConnector)
		{
			
			return parDbConnector.ExecuteDataTable("SelectArticleCategories",null);
		}
		public void SelectArticleCategoriesByArticleCategoryId(entArticleCategories parEntArticleCategories, DbConnector parDbConnector)
		{
			DbParamCollection insDbParamCollection = new DbParamCollection();
			insDbParamCollection.Add("@pArticleCategoryId",parEntArticleCategories.ArticleCategoryId);
			DataTable insDataTable = new DataTable();
			insDataTable = parDbConnector.ExecuteDataTable("SelectArticleCategoriesByArticleCategoryId",insDbParamCollection);
			if (insDataTable.Rows.Count>0)
			{
				if (insDataTable.Rows[0]["ArticleCategoryId"]!=DBNull.Value)
				{
					parEntArticleCategories.ArticleCategoryId = Convert.ToInt32(insDataTable.Rows[0]["ArticleCategoryId"]);
				}
				if (insDataTable.Rows[0]["ArticleCategoryDescription"]!=DBNull.Value)
				{
					parEntArticleCategories.ArticleCategoryDescription = insDataTable.Rows[0]["ArticleCategoryDescription"].ToString();
				}
			}
		}

		#endregion
        public DataTable SelectArticleCategoriesByLanguageId(DbConnector parDbConnector)
        {
            DbParamCollection insDbParamCollection = new DbParamCollection();
            insDbParamCollection.Add("@pLanguageId", CurrentContext.LanguageId);
            return parDbConnector.ExecuteDataTable("SelectArticleCategoriesByLanguageId", insDbParamCollection);
        }
	}
}